package com.jhws.sys.appUser.bo;

import com.jhws.common.base.bo.BaseBo;
import org.hibernate.annotations.Type;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * 2017年2月24日
 *
 * @author Alex Tan
 * <p>
 * Sip绑定关系表实体类
 * <p>
 * 每条数据代表一个sip账号之间的绑定关系，可用于呼叫、监视与开锁
 */
@Table(name = "tbl_sipaccount_bindings")
@Entity
public class TblSipAcountBindings extends BaseBo {

    /**
     * 序列化
     */
    private static final long serialVersionUID = 5447205204857052054L;

    /**
     * 主键
     */
    @Id
    @Column(name = "acount_id")
    private String id;
    /**
     * sip账号,代表被绑定者
     */
    @Column(name = "username")
    private String username;
    /**
     * sip账号，欲绑定的目标
     */
    @Column(name = "binding")
    private String binding;
    /**
     * 绑定类型
     * <p>
     * indoor - 室内机绑定，代表'bindindg'是室内机账号，主要用于门口机呼叫室内机时可以自动呼叫'username'
     * villa - 别墅机绑定, 代表'binding'是别墅机账号
     * manager - 管理机绑定, 代表该账号与物业管理机绑定了，呼叫管理机时同时呼叫该手机号
     * m_unlock - 监视与开锁绑定, 该绑定与呼叫无关，主要用于app获取监视与开锁列表(业主默认的楼栋不会生成数据,由api自动添加了)
     */
    @Column(name = "binding_type")
    private String bindingType;
    /**
     * 标识该号码是否支持PSTN落地呼叫
     */
    @Column(name = "PSTN", columnDefinition = "INT default 0")
    private int pstn;
    /**
     * 呼叫使能
     * 如果为false, 表示开启了免打扰功能，呼叫时不会再呼叫绑定的该username
     */
    @Type(type = "yes_no")
    @Column(name = "is_call", columnDefinition = "varchar(1) default 'Y'")
    private boolean isCall = true;

    @Column(name = "is_synch", columnDefinition = "INT default 0")
    private int isSynch; //是否同步

    public String getBindingType() {
        return bindingType;
    }

    public void setBindingType(String bindingType) {
        this.bindingType = bindingType;
    }

    public int getPstn() {
        return pstn;
    }

    public void setPstn(int pstn) {
        this.pstn = pstn;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getBinding() {
        return binding;
    }

    public void setBinding(String binding) {
        this.binding = binding;
    }

    public boolean getIsCall() {
        return isCall;
    }

    public void setIsCall(boolean isCall) {
        this.isCall = isCall;
    }

    public int getIsSynch() {
        return isSynch;
    }

    public void setIsSynch(int isSynch) {
        this.isSynch = isSynch;
    }

    @Override
    public String toString() {
        return "TblSipAcountBindings{" +
                "id='" + id + '\'' +
                ", username='" + username + '\'' +
                ", binding='" + binding + '\'' +
                ", bindingType='" + bindingType + '\'' +
                ", pstn=" + pstn +
                ", isCall=" + isCall +
                ", isSynch=" + isSynch +
                '}';
    }
}
